﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace SharpDiary.Core.Controls
{
    public class NeotomaTabControl : TabControl
    {
        public NeotomaTabControl()
        {
            UpdateRegion();
        }

        private void UpdateRegion()
        {
            if (this.TabPages.Count == 0) { return; }

            this.Region = new System.Drawing.Region(new RectangleF(TabPages[0].Left, TabPages[0].Top, TabPages[0].Width, TabPages[0].Height));
        }

        protected override void OnSizeChanged(EventArgs e)
        {
            base.OnSizeChanged(e);

            UpdateRegion();
        }

        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);

            UpdateRegion();
        }
    }
}
